package com.example.blog.mapper;

import com.example.blog.entity.Comment;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author ly
 * @since 2023-08-03
 */
public interface CommentMapper extends BaseMapper<Comment> {

    @Select("select a.*, " +
            "b.name \"user.name\"," +
            "b.head \"user.head\"" +
            " from comment a join user b on a.createBy=b.id" +
            " where a.articleId=#{aid}" +
            " order by id desc")
    List<Comment> selectByAid(int aid);

}
